import { instance as request } from "../utils/request";
// 登录
export const addBill = (data: any) => {
  return request({
    url: "/addBill",
    method: "post",
    data,
  });
};
export const delBill = (data: any) => {
  return request({
    url: "/delBill",
    method: "post",
    data,
  });
};

export const getBill = (data: any) => {
  return request({
    url: "/getBill",
    method: "post",
    data,
  });
};

export const putBill = (data: any) => {
  return request({
    url: "/putBill",
    method: "post",
    data,
  });
};

export const getBillList = ({ data, params }: { data: any; params: any }) => {
  return request({
    url: "/getBillList",
    method: "post",
    params,
    data,
  });
};

export const getRandomCode = () => {
  return request({
    url: "/getRandomCode",
    method: "get",
  });
};

export const dataExport = ({ data, params }: { data: any; params: any }) => {
  return request({
    url: "/exportData",
    method: "post",
    params,
    data,
    responseType: 'blob', // 设置响应类型为 blob
  });
};

export const findSupplier = (data: any) => {
  return request({
    url: "/findSupplier",
    method: "post",
    data,
  });
};

export const getTotalAmount = ({ data, params }: { data: any; params: any }) => {
  return request({
    url: "/getTotalAmount",
    method: "post",
    params,
    data,
  });
};
